package Chapter7;
//145页程序7.4 从文件中读出对象

import java.io.*;

public class ObjectRecovery implements Serializable{ //recovery恢复
    public static void main(String[] args) {
        Student stu =null;
        try {
            FileInputStream fi = new FileInputStream("asd2.txt");
            ObjectInputStream si = new ObjectInputStream(fi);
            stu = (Student) si.readObject();
            si.close();
        }catch (Exception e){
            System.out.println(e);
        }
        System.out.println("ID："+stu.id+"Name："+stu.name+"Age："+stu.age+"department："+stu.department);
    }
}
